#ifndef xpack_test_math_sin
#define xpack_test_math_sin
#pragma push_macro("xuser")
#undef  xuser
#define xuser mixc::test_math_sin::inc
#include"test/helper.hpp" // 需要放第一
#include"define/nan.hpp"
#include"math/abs.hpp"
#include"math/literal.hpp"
#include"math/sin.hpp"
#include<math.h>
#pragma pop_macro("xuser")

namespace mixc::test_math_sin{
    namespace inc{
        using namespace literal;
    }

    xtest("sin"){
        xassert_fe(::sin(0), inc::sin(0.0));
        xassert_fe(::sin(1), inc::sin(1.0));
        xassert_fe(::sin(-1), inc::sin(-1.0));
        xassert_fe(::sin(inc::pi), inc::sin(inc::pi));
        xassert_fe(::sin(inc::pi / 4), inc::sin(inc::pi / 4));
        xassert_fe(::sin(inc::pi / 2), inc::sin(inc::pi / 2));
        xassert_fe(::sin(inc::pi * 3 / 4), inc::sin(inc::pi * 3 / 4));
        xassert_fe(::sin(-inc::pi), inc::sin(-inc::pi));
        xassert_fe(::sin(-inc::pi / 4), inc::sin(-inc::pi / 4));
        xassert_fe(::sin(-inc::pi / 2), inc::sin(-inc::pi / 2));
        xassert_fe(::sin(-inc::pi * 3 / 4), inc::sin(-inc::pi * 3 / 4));

        f64 expect      = {};
        f64 actually    = {};
        f64 v           = 1.0;

        for(ixx i = -2048; i < 2048; i++){
            v           = inc::pi / 127 * i + 0.01;
            expect      = ::sin(v);
            actually    = inc::sin(v);
            xassert_fe(expect, actually, v, i);
        }
    };
}

#endif
